package org.xhystudy.rpc.annotation;

import org.springframework.beans.factory.annotation.Autowired;
import org.xhystudy.rpc.registry.loadbalancer.LoadBalancerType;
import org.xhystudy.rpc.tolerant.FaultTolerantType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @description: 服务消费方,在使用该注解后还应添加这个注解忽视错误
 * @SuppressWarnings({"SpringJavaAutowiredFieldsWarningInspection", "SpringJavaInjectionPointsAutowiringInspection"})
 * 本人尝试过使用@Resource但是会注入不了ioc。其他方式也尝试过，水平能力有限
 * @Author: Xhy
 * @gitee: https://gitee.com/XhyQAQ
 * @copyright: B站: https://space.bilibili.com/152686439
 * @CreateTime: 2023-04-24 23:32
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Autowired
public @interface RpcReference {

    String serviceVersion() default "1.0";

    long timeout() default 5000;

    LoadBalancerType loadBalancerType() default LoadBalancerType.RoundRobin;

    FaultTolerantType faultTolerantType() default FaultTolerantType.Failover;

    long retryCount() default 3;
}
